package cn.tedu.pojo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

@RestController
@RequestMapping("car")
public class CarController {

    @RequestMapping("get3")
    public String get3(Integer id , String name){
        return id+name;
    }
    public  void get2(){
        String usl ="http://localhost:8080/car/fin?id=911&name=保时捷&color=红色";
        String[] s1=usl.split("\\?");
        System.out.println(Arrays.toString(s1));
        String usl2 = s1[1];
        String[] s2=usl2.split("&");
        System.out.println(Arrays.toString(s2));
        for (String s : s2){
            String key = s.split("=")[0];
            String value=s.split("=")[1];
//           System.out.println(key+"="+value);
            System.out.println(value);
        }

    }






    @RequestMapping("fin")
    public Car fin(){
        Car c =new Car();
        c.setId(718);
        c.setName("保时捷");
        c.setColor("红色");
        return c;
    }
    @RequestMapping("get")
    public void get(){
        System.out.println("sss");
    }
    @RequestMapping("eat")
    public String eat(){

        return "ticket";
    }
}
